package com.jy.wms.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.jy.wms.common.base.BaseController;
import com.jy.wms.common.base.JsonResult;
import com.jy.wms.pojo.WmsPickingTaskPda;
import com.jy.wms.service.WmsPickingTaskPdaService;

import javax.servlet.http.HttpSession;

import com.github.pagehelper.Page;
import com.jy.wms.common.base.ResultPage;

import java.util.List;

import com.jy.wms.common.UUIDUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

/**
 * @ClassName: WmsPickingTaskPdaController
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @Author Yjs
 * @Date Mon Jan 15 13:44:19 GMT+08:00 2018
 */
@RestController
@RequestMapping("/wmspickingtaskpda")
@Api(value = "/wmspickingtaskpda", description = "")
public class WmsPickingTaskPdaController extends BaseController<WmsPickingTaskPdaService, WmsPickingTaskPda> {

    @PostMapping(value = {"list", ""})
    @ApiOperation(value = "查询信息", response = JSONObject.class, notes = "查询信息")
    public @ResponseBody
    ResultPage<WmsPickingTaskPda> getWmsPickingTaskPda(@RequestBody WmsPickingTaskPda entity, HttpSession session) {
        Page<WmsPickingTaskPda> list = baseService.baseSelectPage(entity);
        return renderPage(list);
    }

    @PostMapping(value = "delete")
    @ApiOperation(value = "删除信息", response = JSONObject.class, notes = "删除信息")
    public @ResponseBody
    JsonResult deleteWmsPickingTaskPda(@RequestBody List<String> ids) {
        Integer flag = baseService.baseDeleteBathPrimaryKeys(ids);
        return renderSuccess("删除成功");
    }

    @PostMapping(value = "add")
    @ApiOperation(value = "新增信息", response = JSONObject.class, notes = "新增信息")
    public @ResponseBody
    JsonResult addWmsPickingTaskPda(@RequestBody WmsPickingTaskPda entity) {
        entity.setId(UUIDUtils.uuid());
        baseService.baseInsert(entity);
        return renderSuccess("添加成功");
    }

    @GetMapping(value = "getWmsPickingTaskPda/{id}")
    @ApiOperation(value = "查看单个信息", response = JSONObject.class, notes = "GET查看单个信息")
    public @ResponseBody
    WmsPickingTaskPda getWmsPickingTaskPdaById(@PathVariable("id") String id) {
        WmsPickingTaskPda entity = baseService.baseSelectByPrimaryKey(id);
        return entity;
    }

    @PostMapping(value = "edit")
    @ApiOperation(value = "编辑信息", response = JSONObject.class, notes = "编辑信息")
    public @ResponseBody
    JsonResult editWmsPickingTaskPda(@RequestBody WmsPickingTaskPda entity) {
        Integer flag = baseService.baseUpdateByPrimaryKeySelective(entity);
        return renderSuccess("修改成功");
    }
}
